Class GuardedList<T>

A read-only wrapper for a generic list collection Suitable as a wrapper for LinkedList, HashedLinkedList, ArrayList and HashedArray. LinkedList<T>, HashedLinkedList<T>, ArrayList<T> or .

Implements

IEnumerable<T>, System.Collections.IEnumerable, System.IFormattable, System.ICloneable, System.IDisposable, ICollection<T>, ICollectionValue<T>, IDirectedCollectionValue<T>, IDirectedEnumerable<T>, IExtensible<T>, IIndexed<T>, IList<T>, ISequenced<T>, IShowable

Bases

object, GuardedEnumerable<T>, GuardedCollectionValue<T>, GuardedCollection<T>, GuardedSequenced<T>

Event overview

CollectionChanged, Inherited from GuardedCollectionValue<T> ,
CollectionCleared, Inherited from GuardedCollectionValue<T> ,
ItemInserted, Inherited from GuardedCollectionValue<T> ,
ItemRemovedAt, Inherited from GuardedCollectionValue<T> ,
ItemsAdded, Inherited from GuardedCollectionValue<T> ,
ItemsRemoved, Inherited from GuardedCollectionValue<T>

Property overview

ActiveEvents, Inherited from GuardedCollectionValue<T> ,
AllowsDuplicates, Inherited from GuardedCollection<T> ,
ContainsSpeed, Inherited from GuardedCollection<T> ,
Count, Inherited from GuardedCollectionValue<T> ,
CountSpeed, Inherited from GuardedCollectionValue<T> ,
Direction, Inherited from GuardedSequenced<T> ,
DuplicatesByCounting, Inherited from GuardedCollection<T> ,
EqualityComparer, Inherited from GuardedCollection<T> ,
FIFO ,
First ,
IndexingSpeed ,
IsEmpty, Inherited from GuardedCollection<T> ,
IsFixedSize ,
IsReadOnly, Inherited from GuardedCollection<T> ,
IsValid ,
this[int i] ,
this[int start, int end] ,
Last ,
ListenableEvents, Inherited from GuardedCollectionValue<T> ,
Offset ,
Underlying

Constructor overview

GuardedList<T>(IList<T> list)

Method overview

Add(T item), Inherited from GuardedCollection<T> ,
AddAll<U>(IEnumerable<U> items), Inherited from GuardedCollection<T> ,
All(Fun<T,bool> filter), Inherited from GuardedCollectionValue<T> ,
Apply(Act<T> a), Inherited from GuardedCollectionValue<T> ,
Backwards(), Inherited from GuardedSequenced<T> ,
Check(), Inherited from GuardedCollection<T> ,
Choose(), Inherited from GuardedCollectionValue<T> ,
Clear(), Inherited from GuardedCollection<T> ,
Clone() ,
Contains(T item), Inherited from GuardedCollection<T> ,
ContainsAll<U>(IEnumerable<U> items), Inherited from GuardedCollection<T> ,
ContainsCount(T item), Inherited from GuardedCollection<T> ,
CopyTo(T[] a, int i), Inherited from GuardedCollectionValue<T> ,
Dequeue() ,
Dispose() ,
Enqueue(T item) ,
Equals(object obj), Inherited from object ,
Exists(Fun<T,bool> filter), Inherited from GuardedCollectionValue<T> ,
Filter(Fun<T,bool> filter), Inherited from GuardedCollectionValue<T> ,
Finalize(), Inherited from object ,
Find(ref T item), Inherited from GuardedCollection<T> ,
Find(Fun<T,bool> filter, out T item), Inherited from GuardedCollectionValue<T> ,
FindAll(Fun<T,bool> filter) ,
FindIndex(Fun<T,bool> predicate), Inherited from GuardedSequenced<T> ,
FindLast(Fun<T,bool> predicate, out T item), Inherited from GuardedSequenced<T> ,
FindLastIndex(Fun<T,bool> predicate), Inherited from GuardedSequenced<T> ,
FindOrAdd(ref T item), Inherited from GuardedCollection<T> ,
GetEnumerator(), Inherited from GuardedEnumerable<T> ,
GetHashCode(), Inherited from object ,
GetSequencedHashCode(), Inherited from GuardedSequenced<T> ,
GetType(), Inherited from object ,
GetUnsequencedHashCode(), Inherited from GuardedCollection<T> ,
IndexOf(T item) ,
Insert(int i, T item) ,
Insert(IList<T> pointer, T item) ,
InsertAfter(T item, T target) ,
InsertAll<U>(int i, IEnumerable<U> items) ,
InsertBefore(T item, T target) ,
InsertFirst(T item) ,
InsertLast(T item) ,
IsSorted() ,
IsSorted(System.Collections.Generic.IComparer<T> c) ,
ItemMultiplicities(), Inherited from GuardedCollection<T> ,
LastIndexOf(T item) ,
LastViewOf(T item) ,
Map<V>(Fun<T,V> mapper) ,
Map<V>(Fun<T,V> mapper, System.Collections.Generic.IEqualityComparer<V> itemequalityComparer) ,
MemberwiseClone(), Inherited from object ,
Pop() ,
Push(T item) ,
Remove() ,
Remove(T item), Inherited from GuardedCollection<T> ,
Remove(T item, out T removeditem), Inherited from GuardedCollection<T> ,
RemoveAll<U>(IEnumerable<U> items), Inherited from GuardedCollection<T> ,
RemoveAllCopies(T item), Inherited from GuardedCollection<T> ,
RemoveAt(int i) ,
RemoveFirst() ,
RemoveInterval(int start, int count) ,
RemoveLast() ,
RetainAll<U>(IEnumerable<U> items), Inherited from GuardedCollection<T> ,
Reverse() ,
Reverse(int start, int count) ,
SequencedEquals(ISequenced<T> that), Inherited from GuardedSequenced<T> ,
Show(System.Text.StringBuilder stringbuilder, ref int rest, System.IFormatProvider formatProvider), Inherited from GuardedCollectionValue<T> ,
Shuffle() ,
Shuffle(System.Random rnd) ,
Slide(int offset) ,
Slide(int offset, int size) ,
Sort() ,
Sort(System.Collections.Generic.IComparer<T> c) ,
Span(IList<T> otherView) ,
ToArray(), Inherited from GuardedCollectionValue<T> ,
ToString(string format, System.IFormatProvider formatProvider), Inherited from GuardedCollectionValue<T> ,
ToString(), Inherited from object ,
TrySlide(int offset) ,
TrySlide(int offset, int size) ,
UniqueItems(), Inherited from GuardedCollection<T> ,
UnsequencedEquals(ICollection<T> that), Inherited from GuardedCollection<T> ,
Update(T item), Inherited from GuardedCollection<T> ,
Update(T item, out T olditem), Inherited from GuardedCollection<T> ,
UpdateOrAdd(T item), Inherited from GuardedCollection<T> ,
UpdateOrAdd(T item, out T olditem), Inherited from GuardedCollection<T> ,
View(int start, int count) ,
ViewOf(T item)

Property details

F bool FIFOAccess: Read-Write

Value:True if wrapped list has FIFO semantics for the Add(T item) and Remove() methods

Throws
ReadOnlyCollectionException if used as setter
F T FirstAccess: Read-Only

Value:The first item of the wrapped list

Speed IndexingSpeedAccess: Read-Only

Value:

bool IsFixedSizeAccess: Read-Only
bool IsValidAccess: Read-Only

Value:

F T this[int i]Access: Read-Write

Value:The i'th item of the wrapped list

Throws
ReadOnlyCollectionException if used as setter
F IDirectedCollectionValue<T> this[int start, int end]Access: Read-Only

Value:A directed collection of the items in the indicated interval of the wrapped collection

F T LastAccess: Read-Only

Value:The last item of the wrapped list

F int OffsetAccess: Read-Only

Value:The offset of the wrapped list as a view.

F IList<T> UnderlyingAccess: Read-Only

Value:The wrapped underlying list of the wrapped view

Constructor details

GuardedList<T>(IList<T> list) Wrap a list in a read-only wrapper
Parameters:
list:The list

Method details

object Clone()
Returns:
N T Dequeue()
Throws
ReadOnlyCollectionException since this is a read-only wrappper
Returns:-
F void Dispose() Ignore: this may be called by a foreach or using statement.
N void Enqueue(T item)
Throws
ReadOnlyCollectionException since this is a read-only wrappper
F IList<T> FindAll(Fun<T,bool> filter) Perform FindAll on the wrapped list. The result is not necessarily read-only.
Returns:
Parameters:
filter:The filter to use
F int IndexOf(T item) Find the (first) index of an item in the wrapped collection
Returns:
Parameters:
item:
F void Insert(int i, T item)
Throws
ReadOnlyCollectionException since this is a read-only wrappper
Parameters:
i:
item:
F void Insert(IList<T> pointer, T item)
Throws
ReadOnlyCollectionException since this is a read-only wrappper
Parameters:
pointer:
item:
N void InsertAfter(T item, T target)
Throws
ReadOnlyCollectionException since this is a read-only wrappper
Parameters:
item:
target:
F void InsertAll<U>(int i, IEnumerable<U> items)
Throws
ReadOnlyCollectionException since this is a read-only wrappper
Parameters:
i:
items:
N void InsertBefore(T item, T target)
Throws
ReadOnlyCollectionException since this is a read-only wrappper
Parameters:
item:
target:
F void InsertFirst(T item)
Throws
ReadOnlyCollectionException since this is a read-only wrappper
Parameters:
item:
F void InsertLast(T item)
Throws
ReadOnlyCollectionException since this is a read-only wrappper
Parameters:
item:
F bool IsSorted() Check if wrapped list is sorted according to the default sorting order for the item type T, as defined by the Comparer<T> class
Throws
NotComparableExceptionif T is not comparable
Returns:True if the list is sorted, else false.
F bool IsSorted(System.Collections.Generic.IComparer<T> c) Check if wrapped list is sorted
Returns:True if sorted
Parameters:
c:The sorting order to use
F int LastIndexOf(T item) Find the last index of an item in the wrapped collection
Returns:
Parameters:
item:
F IList<T> LastViewOf(T item) Create the indicated view on the wrapped list and wrap it read-only.
Returns:
Parameters:
item:
F IList<V> Map<V>(Fun<T,V> mapper) Perform Map on the wrapped list. The result is not necessarily read-only.
Type parameters:
VThe type of items of the new list
Returns:The mapped list
Parameters:
mapper:The mapper to use.
F IList<V> Map<V>(Fun<T,V> mapper, System.Collections.Generic.IEqualityComparer<V> itemequalityComparer) Perform Map on the wrapped list. The result is not necessarily read-only.
Type parameters:
VThe type of items of the new list
Returns:The new list.
Parameters:
mapper:The delegate defining the map.
itemequalityComparer:The itemequalityComparer to use for the new list
N T Pop()
Throws
ReadOnlyCollectionException since this is a read-only wrappper
Returns:-
N void Push(T item)
Throws
ReadOnlyCollectionException since this is a read-only wrappper
F T Remove()
Throws
ReadOnlyCollectionException since this is a read-only wrappper
Returns:
F T RemoveAt(int i)
Throws
ReadOnlyCollectionException since this is a read-only wrappper
Returns:
Parameters:
i:
F T RemoveFirst()
Throws
ReadOnlyCollectionException since this is a read-only wrappper
Returns:
F void RemoveInterval(int start, int count)
Throws
ReadOnlyCollectionException since this is a read-only wrappper
Parameters:
start:
count:
F T RemoveLast()
Throws
ReadOnlyCollectionException since this is a read-only wrappper
Returns:
F void Reverse()/ThrowsC5.ReadOnlyCollectionException since this is a read-only wrappper
N void Reverse(int start, int count)
Throws
ReadOnlyCollectionException since this is a read-only wrappper
Parameters:
start:
count:
F void Shuffle()
Throws
ReadOnlyCollectionException since this is a read-only wrappper
F void Shuffle(System.Random rnd)
Throws
ReadOnlyCollectionException since this is a read-only wrappper
Parameters:
rnd:
F IList<T> Slide(int offset)
Throws
ReadOnlyCollectionException if this is a wrapped view and not a view that was made on a wrapper
Parameters:
offset:
F IList<T> Slide(int offset, int size)
Throws
ReadOnlyCollectionException since this is a read-only wrappper
Parameters:
offset:
size:
F void Sort()
Throws
ReadOnlyCollectionException since this is a read-only wrappper
F void Sort(System.Collections.Generic.IComparer<T> c)
Throws
ReadOnlyCollectionException since this is a read-only wrappper
Parameters:
c:
F IList<T> Span(IList<T> otherView)
Returns:
Parameters:
otherView:
F bool TrySlide(int offset)
Throws
ReadOnlyCollectionException since this is a read-only wrappper
Returns:
Parameters:
offset:
F bool TrySlide(int offset, int size)
Throws
ReadOnlyCollectionException since this is a read-only wrappper
Returns:
Parameters:
offset:
size:
F IList<T> View(int start, int count) Create the indicated view on the wrapped list and wrap it read-only.
Returns:
Parameters:
start:
count:
F IList<T> ViewOf(T item) Create the indicated view on the wrapped list and wrap it read-only.
Returns:
Parameters:
item: